package com.aiyige.model.response;

import com.aiyige.base.api.ResponseCode;

/**
 * Created by xiachao on 2017/10/23.
 */


public class BaseResponse<T> {
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean success() {
        return code == ResponseCode.SUCCESS;
    }

    public boolean hasError() {
        return !success();
    }

    private int code = -1;
    private String message;
    private T data;
    private String error;

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }
}
